# Makefile for gcc compiler for iPhone

PROJECTNAME=test
DYLIBNAME=$(PROJECTNAME)

CC=arm-apple-darwin9-gcc
LD=$(CC)
LDFLAGS = -fno-exceptions  -arch arm  -Os -Wall -Werror -pipe
LDFLAGS += -multiply_defined suppress
LDFLAGS += -lobjc
LDFLAGS += -framework Foundation 
LDFLAGS += -framework CoreFoundation 

CFLAGS =  -Os -Wall -NDEBUG -pipe -fvisibility-inlines-hidden
CFLAGS += -DMAC_OS_X_VERSION_MAX_ALLOWED=1050

BUILDDIR=/Library/MobileSubstrate/DynamicLibraries
SRCDIR=.
OBJS=$(patsubst %.m,%.o,$(wildcard $(SRCDIR)/*.m))

all:	dist

$(DYLIBNAME):	$(OBJS)
	$(LD) $(LDFLAGS) -o $@ $^

%.o:	%.m
	$(CC) -c $(CFLAGS) $< -o $@

dist:	$(DYLIBNAME)
	arm-apple-darwin9-strip -SXx $(DYLIBNAME)
	
clean:
	@rm -f $(SRCDIR)/*.o
	@rm -f $(SRCDIR)/$(DYLIBNAME)
